<?php

class openapi_api_function_v1_ectools extends openapi_api_function_abstract implements openapi_api_function_interface{

    /**
     * 展示所有地区
     * @params null
     * @return null
     */
    function getregions($params,&$code,&$sub_msg)
    {
        $obj_regions_op = kernel::service('ectools_regions_apps', array('content_path'=>'ectools_regions_operation'));
        if ($obj_regions_op->getTreeSize())
        {
            //超过100条
            return $this->apiData(true,array('area'=>$obj_regions_op->getRegionById()),200);
        }
        else
        {
            $obj_regions_op->getMap();
            return $this->apiData(true,array('area'=>$obj_regions_op->regions),200);
        }
    }

    public function getChildNode($params,&$code,&$sub_msg)
    {
        $obj_regions_op = kernel::service('ectools_regions_apps', array('content_path'=>'ectools_regions_operation'));
        return $this->apiData(true,array('area'=>$obj_regions_op->getRegionById($params['regionId'])),200);
    }

}